import fetch from 'utils/fetch';
import {urlGenerator} from  '../config.js';


export function loginByEmail(email, password) {
  const data = {
    user:email,
    password:password
  };
  return fetch({
    // url: urlGenerator('PtSignIn'),
    url: urlGenerator('PtSignIn'),
    method: 'post',
    data,
    headers: { 'Content-Type': 'application/x-www-form-urlencoded'}
    
  });
}

export function logout() {
  return fetch({
    url: '/login/logout',
    method: 'post'
  });
}

export function getInfo(token) {
  return fetch({
    url: '/user/info',
    method: 'get',
    params: { token }
  });
}

